package thread;

import java.util.Scanner;
import java.util.concurrent.TimeUnit;

/**
 * 倒计时实现
 */
public class ThreadTimeDemo01 {
    static int count;
    public static void main(String[] args) {
        System.out.println("输入一个时间整数，然后进行倒计时操作");
        Scanner sc=new Scanner(System.in);
        count=sc.nextInt();
        new Thread(()->{
            while(true) {
                if(count==0) {
                    System.out.println("时间到了");
                    break;
                }
                System.out.println(count--);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
            }
        }).start();
    }
}
